import { createRouter, createWebHistory } from 'vue-router'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      component: () => import('@/views/login/LoginPage.vue')
    },
    {
      path: '/register',
      component: () => import('@/views/register/RegisterPage.vue')
    },
    //学生端
    {
      path:'/layout',
      component: () => import('@/views/student/layout/LayoutContainer.vue'),
      redirect:'/layout/question/list?subject=math',
      children: [
        {
          path: '/layout/question/analysis',
          component: () => import('@/views/student/layout/question/QuestionAnalysis.vue')
        },
        {
          path: '/layout/question/list',
          component: () => import('@/views/student/layout/question/QuestionList.vue')
        },
        {
          path: '/layout/question/content',
          component: () => import('@/views/student/layout/question/QuestionContent.vue')
        },
        {
          path: '/layout/class/join',
          component: () => import('@/views/student/layout/class/ClassJoin.vue')
        },
        {
          path: '/layout/parent/bind',
          component: () => import('@/views/student/layout/parent/ParentBind.vue')
        }
      ]
    },
    //家长端
    {
      path:'/parent/layout',
      component: () => import('@/views/parent/layout/LayoutContainer.vue'),
      redirect:'/parent/layout/question/list?subject=math',
      children: [
        {
          path: '/parent/layout/question/analysis',
          component: () => import('@/views/parent/layout/question/QuestionAnalysis.vue')
        },
        {
          path: '/parent/layout/question/list',
          component: () => import('@/views/parent/layout/question/QuestionList.vue')
        },
        {
          path: '/parent/layout/question/content',
          component: () => import('@/views/parent/layout/question/QuestionContent.vue')
        },
        {
          path: '/parent/layout/student/list',
          component: () => import('@/views/parent/layout/student/QuestionList.vue')
        },
        {
          path: '/parent/layout/student/content',
          component: () => import('@/views/parent/layout/student/QuestionContent.vue')
        },
        {
          path: '/parent/layout/analysis',
          component: () => import('@/views/parent/layout/analysis/Analysis.vue')
        }
      ]
    },
    //教师端
    {
      path:'/teacher/layout',
      component: () => import('@/views/teacher/layout/LayoutContainer.vue'),
      redirect:'/teacher/layout/question/list?subject=math',
      children: [
        {
          path: '/teacher/layout/question/analysis',
          component: () => import('@/views/teacher/layout/question/QuestionAnalysis.vue')
        },
        {
          path: '/teacher/layout/question/list',
          component: () => import('@/views/teacher/layout/question/QuestionList.vue')
        },
        {
          path: '/teacher/layout/question/content',
          component: () => import('@/views/teacher/layout/question/QuestionContent.vue')
        },
        {
          path: '/teacher/layout/student/list',
          component: () => import('@/views/teacher/layout/student/QuestionList.vue')
        },
        {
          path: '/teacher/layout/student/content',
          component: () => import('@/views/teacher/layout/student/QuestionContent.vue')
        },
        {
          path: '/teacher/layout/fault',
          component: () => import('@/views/teacher/layout/fault/fault.vue')
        },
        {
          path: '/teacher/layout/class',
          component: () => import('@/views/teacher/layout/class/classJoin.vue')
        }
      ]
    },
    //管理员端
    {
      path:'/admin/layout',
      component: () => import('@/views/admin/layout/LayoutContainer.vue'),
      redirect:'/admin/layout/question/list?subject=math',
      children: [
        {
          path: '/admin/layout/question/analysis',
          component: () => import('@/views/admin/layout/user/QuestionAnalysis.vue')
        },
        {
          path: '/admin/layout/question/list',
          component: () => import('@/views/admin/layout/user/userList.vue')
        },
        {
          path: '/admin/layout/student/list',
          component: () => import('@/views/admin/layout/test/testList.vue')
        },
        {
          path: '/admin/layout/student/content',
          component: () => import('@/views/admin/layout/test/QuestionContent.vue')
        },
        {
          path: '/admin/layout/fault',
          component: () => import('@/views/admin/layout/fault/fault.vue')
        },
        {
          path: '/admin/layout/class',
          component: () => import('@/views/admin/layout/class/ClassAnalysis.vue')
        }
      ]
    }
  ]
})

export default router
